#ifndef __VEC__HPP__
#define __VEC__HPP__

template<typename Type, int Num>
class Vec
{
public:
  Vec()
  {  
  };

  virtual ~Vec()
  {  
  };


  Type Get(unsigned int idx)
  {
    return data[idx];
  };
  
  void Set(unsigned int idx, Type val)
  {
    data[idx] = val;
  };

  void operator=(Vec<Type,Num>& from)
  {
    for(unsigned int i = 0;
	i < Num;
	i++)
      {
	this->Set(i, from.Get(i) );
      }
  };

  Vec<Type,Num> operator+(Vec<Type,Num>& from)
  {
    Vec<Type,Num> ret;
    for(unsigned int i = 0;
	i < Num;
	i++)
      {
	ret.Set(i, this->Get(i) + from.Get(i) );
      }
    return ret;
  };

  bool isInRect(Vec<Type,Num>& p1, Vec<Type,Num>& p2)
  {
	  bool ret = true;
	  for(unsigned int i = 0;
		i < Num;
		i++)
		  {
			  if(!( (this->Get(i) > p1.Get(i) ) && 
				   ( this->Get(i) < (p1.Get(i) + p2.Get(i)) ) )
				   )
			  {
				  ret = false;
			  }
		  }
    return ret;
  }

private:

  Type data[Num];

};


#endif
